<?php defined('IN_PHPCMS') or exit('Access Denied'); ?><?php include template('yp', 'header'); ?>
<div id="main">
  <div id="right">
    <div id="position"><strong>当前位置：</strong><a href="<?php echo $M['url'];?>">企业黄页</a><a href="<?php echo $M['url'];?>buy.php">商机</a></div>
    <?php if($catid) { ?>
<dl id="catlist">
<dt><?php echo $catname;?></dt>
     <?php if(is_array($arrchildid)) foreach($arrchildid AS $cid => $c) { ?>
<dd><a href="<?php echo $M['url'];?>buy.php?catid=<?php echo $cid;?>"><?php echo $c['catname'];?></a><span>(<?php echo $CATEGORY[$cid]['items'];?>)</span></dd>
   <?php } ?>
    </dl>
<?php } ?>
    <div class="bk_10"></div>
    <div id="hy">
      <div class="f_r" id="show_num"><span>每页显示信息数量</span><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&pagesize=20&tid=<?php echo $tid;?>&areaname=<?php echo $areaname;?>&catid=<?php echo $catid;?>&order=<?php echo $order;?>">20</a><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&pagesize=40&tid=<?php echo $tid;?>&areaname=<?php echo $areaname;?>&catid=<?php echo $catid;?>&order=<?php echo $order;?>">40</a><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&pagesize=60&tid=<?php echo $tid;?>&areaname=<?php echo $areaname;?>&catid=<?php echo $catid;?>&order=<?php echo $order;?>">60</a></div>
      <ul>
        <li class="on_<?php if(!$tid) { ?>5<?php } else { ?>1<?php } ?>"><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&pagesize=<?php echo $pagesize;?>&tid=0&areaname=<?php echo $areaname;?>&catid=<?php echo $catid;?>&order=<?php echo $order;?>">所有产品</a></li>
        <li class="on_<?php if($tid == 1) { ?>6<?php } else { ?>7<?php } ?>"><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&pagesize=<?php echo $pagesize;?>&tid=1&areaname=<?php echo $areaname;?>&catid=<?php echo $catid;?>&order=<?php echo $order;?>">供应</a></li>
        <li class="on_<?php if($tid == 2) { ?>6<?php } else { ?>7<?php } ?>"><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&pagesize=<?php echo $pagesize;?>&tid=2&areaname=<?php echo $areaname;?>&catid=<?php echo $catid;?>&order=<?php echo $order;?>">求购</a></li>
<li class="on_<?php if($tid == 3) { ?>6<?php } else { ?>7<?php } ?>"><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&pagesize=<?php echo $pagesize;?>&tid=3&areaname=<?php echo $areaname;?>&catid=<?php echo $catid;?>&order=<?php echo $order;?>">二手</a></li>
<li class="on_<?php if($tid == 4) { ?>6<?php } else { ?>7<?php } ?>"><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&pagesize=<?php echo $pagesize;?>&tid=4&areaname=<?php echo $areaname;?>&catid=<?php echo $catid;?>&order=<?php echo $order;?>">促销</a></li>
      </ul>
    </div>
    <div class="gsxx_1">
      <ul class="pai_lie">
<li><a href="<?php echo $M['url'];?>buy.php?view_type=2&catid=<?php echo $catid;?>&pagesize=<?php echo $pagesize;?>&areaname=<?php echo $areaname;?>&order=<?php echo $order;?>&tid=<?php echo $tid;?>"><span class="tw<?php if($view_type==2) { ?>_1<?php } ?>">图片</span></a><a href="<?php echo $M['url'];?>buy.php?view_type=1&catid=<?php echo $catid;?>&pagesize=<?php echo $pagesize;?>&areaname=<?php echo $areaname;?>&order=<?php echo $order;?>&tid=<?php echo $tid;?>"><span class="wz<?php if($view_type==1) { ?>_1<?php } ?>">图文</span></a><a href="<?php echo $M['url'];?>buy.php?view_type=3&catid=<?php echo $catid;?>&pagesize=<?php echo $pagesize;?>&areaname=<?php echo $areaname;?>&order=<?php echo $order;?>&tid=<?php echo $tid;?>"><span class="tp<?php if($view_type==3) { ?>_1<?php } ?>">文字</span></a></li>
  </ul>
  <?php if($view_type == 1) { ?>
      <span class="gsjs2">公司信息</span>
      <span class="zczj"><?php if($order) { ?><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&catid=<?php echo $catid;?>&pagesize=<?php echo $pagesize;?>&areaname=<?php echo $areaname;?>&order=0">↑</a><?php } else { ?><a href="<?php echo $M['url'];?>buy.php?view_type=<?php echo $view_type;?>&catid=<?php echo $catid;?>&pagesize=<?php echo $pagesize;?>&areaname=<?php echo $areaname;?>&order=1">↓</a><?php } ?>单价（元）</span>
  <?php } ?>
      <span class="area">
<form name='myform' id='myform' method="get">
<input type="hidden" name="pagesize" value="<?php echo $pagesize;?>">
<input type="hidden" name="catid" value="<?php echo $catid;?>">
<input type="hidden" name="view_type" value="<?php echo $view_type;?>">
<input type="hidden" name="order" value="<?php echo $order;?>">
<select name="areaname" id="areaname" onchange="my_submit(this.form);">
<option value=""> 所在地</option>
<option value='江苏,浙江,上海'>江浙沪</option>
<option value='广州,深圳,中山,珠海,佛山,东莞,惠州'>珠三角</option>
<option value='香港,澳门,台湾'>港澳台</option>
<option value='海外'>海外</option>
<option value='北京'>北京</option>
<option value='上海'>上海</option>
<option value='杭州'>杭州</option>
<option value='广州'>广州</option>
<option value='深圳'>深圳</option>
<option value='南京'>南京</option>
<option value='武汉'>武汉</option>
<option value='天津'>天津</option>
<option value='成都'>成都</option>
<option value='哈尔滨'>哈尔滨</option>
<option value='重庆'>重庆</option>
<option value='宁波'>宁波</option>
<option value='无锡'>无锡</option>
<option value='济南'>济南</option>
<option value='苏州'>苏州</option>
<option value='温州'>温州</option>
<option value='青岛'>青岛</option>
<option value='沈阳'>沈阳</option>
<option value='福州'>福州</option>
<option value='西安'>西安</option>
<option value='长沙'>长沙</option>
<option value='合肥'>合肥</option>
<option value='南宁'>南宁</option>
<option value='南昌'>南昌</option>
<option value='郑州'>郑州</option>
<option value='厦门'>厦门</option>
<option value='大连'>大连</option>
<option value='常州'>常州</option>
<option value='石家庄'>石家庄</option>
<option value='东莞'>东莞</option>
<option value='安徽'>安徽</option>
<option value='福建'>福建</option>
<option value='甘肃'>甘肃</option>
<option value='广东'>广东</option>
<option value='广西'>广西</option>
<option value='贵州'>贵州</option>
<option value='海南'>海南</option>
<option value='河北'>河北</option>
<option value='黑龙江'>黑龙江</option>
<option value='河南'>河南</option>
<option value='湖北'>湖北</option>
<option value='湖南'>湖南</option>
<option value='江苏'>江苏</option>
<option value='江西'>江西</option>
<option value='吉林'>吉林</option>
<option value='辽宁'>辽宁</option>
<option value='内蒙古'>内蒙古</option>
<option value='宁夏'>宁夏</option>
<option value='青海'>青海</option>
<option value='山东'>山东</option>
<option value='山西'>山西</option>
<option value='陕西'>陕西</option>
<option value='四川'>四川</option>
<option value='新疆'>新疆</option>
<option value='西藏'>西藏</option>
<option value='云南'>云南</option>
<option value='浙江'>浙江</option>
<option value="">所有地区</option>
<option value='other'>其它</option>
          </select>
</form>
  </span>
    </div>
    <div class="clear"></div>
    <!--图文列表开始-->
<?php if($view_type == 1) { ?>
    <div id="show_0">
<?php $ARRAY = get("SELECT b.*,c.companyname,c.areaname FROM `phpcms_yp_buy` `b`, `phpcms_member_company` `c` WHERE b.userid = c.userid AND b.status = 99 AND $where", $pagesize, $page, "", "", "","","0");$DATA=$ARRAY['data'];$total=$ARRAY['total'];$count=$ARRAY['count'];$pages=$ARRAY['pages'];unset($ARRAY);foreach($DATA AS $n=>$r){$n++;?>	
<dl class="list_1 list_2">
      <dt><strong><a href="<?php echo show_url('buy',$r[id]);?>"><samp class="<?php echo $r['style'];?>"><?php echo $r['title'];?></samp></a></strong><span class="zczj"><?php echo $r['price'];?></span><span class="area"><?php echo $r['areaname'];?></span></dt>
      <dd class="pic"><a href="<?php echo show_url('buy',$r[id]);?>"><img src="<?php echo thumb($r['thumb'],120,80);?>" alt="<?php echo $r['title'];?>" width="120" height="80"/></a></dd>
      <dd><strong>产品简介：</strong><?php echo str_cut(strip_tags($r['content']),180,'..');?> </dd>
      <dd><span class="time f_r"><?php echo date("Y-m-d H:i:s",$r['inputtime']);?></span><strong>生产商：</strong><a href="<?php echo company_url($r['userid']);?>"><?php echo $r['companyname'];?></a></dd>
    </dl>
<?php } unset($DATA); ?>
    </div>
    <!--图文列表结束-->
    <!--文字列表开始-->
<?php } elseif ($view_type == 3) { ?>
    <div id="show_1">
    <ul class="text_list_f14">
<?php $ARRAY = get("SELECT b.*,c.companyname,c.areaname FROM `phpcms_yp_buy` `b`, `phpcms_member_company` `c` WHERE b.userid = c.userid AND b.status = 99 AND $where", $pagesize, $page, "", "", "","","0");$DATA=$ARRAY['data'];$total=$ARRAY['total'];$count=$ARRAY['count'];$pages=$ARRAY['pages'];unset($ARRAY);foreach($DATA AS $n=>$r){$n++;?>	
  <li><span class="good_name"><a href="<?php echo show_url('buy',$r[id]);?>"><samp class="<?php echo $r['style'];?>"><?php echo $r['title'];?></samp></a></span> <span class="company_name"><a href="<?php echo company_url($r[userid]);?>"><samp> <?php echo $r['companyname'];?> </samp></a></span><span class="good_money"> <?php echo $r['price'];?>元 </span><span class="time f_r"><?php echo date('Y-m-d H:i',$r[inputtime]);?></span>
 </li>
     <div class="clear"></div>
    <?php } unset($DATA); ?>
    </ul>
    </div>
    <!--文字列表结束-->
    <!--图片列表开始-->
<?php } else { ?>
    <div id="show_2">
    <ul class="s_pic_list">
<?php $ARRAY = get("SELECT b.*,c.companyname,c.areaname FROM `phpcms_yp_buy` `b`, `phpcms_member_company` `c` WHERE b.userid = c.userid AND b.status = 99 AND $where", $pagesize, $page, "", "", "","","0");$DATA=$ARRAY['data'];$total=$ARRAY['total'];$count=$ARRAY['count'];$pages=$ARRAY['pages'];unset($ARRAY);foreach($DATA AS $n=>$r){$n++;?>	
      <li><a href="<?php echo show_url('buy',$r[id]);?>"><img src="<?php echo thumb($r['thumb'],120,80);?>" alt="产品图片" width="126" height="80"/><samp class="<?php echo $r['style'];?>"><?php echo $r['title'];?></samp></a></li>
<?php } unset($DATA); ?>
    </ul>
    </div>
    <!--图片列表结束-->
<?php } ?>
    <div id="pages"><?php echo $pages;?></div>
  </div>
  <div id="left">
    <div class="box_t">
      <h3>产品库大类列表</h3>
    </div>
    <div class="box_c">
      <ul class="text_list w_100">
      <?php $DATA = get("SELECT catname,catid FROM `phpcms_category` WHERE module = 'yp' AND parentid = '0' ORDER BY listorder ASC", 0, 0, "", "");foreach($DATA AS $n => $r) { $n++;?>
<li><a href="<?php echo list_url('buy',$r[catid]);?>"><?php echo $r['catname'];?></a></li>
  <?php } unset($DATA); ?>
      </ul>
      <div class="clear"></div>
    </div>
    <div class="box_b"></div>
    <div class="bk_10"></div>
    <div class="box_t">
      <h3>浏览过的产品</h3>
    </div>
    <div class="box_c">
      <ul class="pic_list_1">
      <?php if($prowhere) { ?>
  <?php $DATA = get("SELECT id,title,thumb FROM `phpcms_yp_product` WHERE id IN ($prowhere) ORDER BY FIND_IN_SET(id,'$prowhere')", 10, 0, "", "");foreach($DATA AS $n => $r) { $n++;?>
  <li><a href="<?php echo show_url('product',$r[id]);?>"><img src="<?php echo thumb($r['thumb'],48,48,1,'images/no_pic_50_50.gif');?>" alt="" width="48" height="48"/></a><a href="<?php echo show_url('product',$r['id']);?>" title="<?php echo $r['title'];?>"><?php echo $r['title'];?></a></li>
  <?php } unset($DATA); ?>
  <?php } else { ?>
  <li>您还没有浏览过任何商品</li>
  <?php } ?>
      </ul>
      <div class="clear"></div>
    </div>
    <div class="box_b"></div>
    <div class="bk_10"></div>
    <div class="box_t">
      <h3>最新产品</h3>
    </div>
    <div class="box_c">
      <ul class="pic_list">
        <?php $DATA = get("SELECT p.id,p.title,p.thumb,c.companyname,p.userid FROM `phpcms_yp_product` `p`,`phpcms_member_company` `c` WHERE c.userid = p.userid ORDER BY id DESC", 10, 0, "", "");foreach($DATA AS $n => $r) { $n++;?>
<li>
<img src="<?php echo thumb($r['thumb'],48,48,1,'images/no_pic_50_50.gif');?>" alt="" width="48" height="48"/>
<a href="<?php echo show_url('product',$r[id]);?>" title="<?php echo $r['title'];?>"><strong><?php echo str_cut($r['title'],20,'');?></strong></a>
<span><a href="<?php echo company_url($r['userid']);?>" title="<?php echo $r['companyname'];?>"><?php echo str_cut($r['companyname'],20,'');?></a></span>
</li>
<?php } unset($DATA); ?>
      </ul>
    </div>
    <div class="box_b"></div>
    <div class="bk_10"></div>
    <div class="box_t">
      <h3>推荐产品</h3>
    </div>
    <div class="box_c">
      <ul class="pic_list">
        <?php $DATA = get("SELECT p.id,p.title,p.thumb,c.companyname,p.userid FROM `phpcms_yp_product` `p`,`phpcms_member_company` `c` WHERE c.userid = p.userid AND p.elite = 1 ORDER BY id DESC", 10, 0, "", "");foreach($DATA AS $n => $r) { $n++;?>
<li><img src="<?php echo thumb($r['thumb'],48,48,1,'images/no_pic_50_50.gif');?>" alt="" width="48" height="48"/><a href="<?php echo show_url('product',$r[id]);?>"><strong><?php echo str_cut($r['title'],20,'');?></strong></a><a href="<?php echo company_url($r['userid']);?>"><span><?php echo str_cut($r['companyname'],20,'');?></span></a></li>
<?php } unset($DATA); ?>
      </ul>
    </div>
    <div class="box_b"></div>
  </div>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!--
function my_submit(form)
{
form.submit();
}
function favorite(title,url)
{
alert(url);
}
$("#areaname").children().each(function(){  if (this.value == '<?php if($areaname) { ?><?php echo urldecode($areaname);?><?php } else { ?>0<?php } ?>')this.selected = true;});
//-->
</SCRIPT>
<?php include template('yp', 'footer'); ?>
